package by.grsu.shedule.model;

import org.json.JSONObject;

import android.graphics.Paint.Join;
import android.os.Parcel;
import android.os.Parcelable;
import by.grsu.shedule.common.annotation.JSON;
import by.grsu.shedule.common.annotation.Tag;
import by.grsu.shedule.common.model.BaseModel;
import by.grsu.shedule.common.model.IModelCreator;

@Tag(keys = { "Schedules","day" }, types = { JSON.JSONObject,JSON.JSONArray }) 
public class Day extends BaseModel {

	public static final IModelCreator<Day> MODEL_CREATOR = new IModelCreator<Day>() {

		public Day create(JSONObject jsonObject) {
			return new Day(jsonObject);
		}

	};

	public static final Parcelable.Creator<Day> CREATOR = new Creator<Day>() {

		public Day[] newArray(int size) {
			return new Day[size];
		}

		public Day createFromParcel(Parcel in) {
			return new Day(in);
		}
	};

	public Day() {
		super();
	}

	public Day(JSONObject json) {
		super(json);
	}

	public Day(Parcel in) {
		super(in);
	}

	public Day(String json) {
		super(json);
	}

	private String getTime() {
		return getString("time");
		
	}

	public String getSubject() {
		return getString("subject");
	}

	public String getTeacher() {
		return getString("teacher");
	}

	public String getAuditory() {
		return getString("auditorys");
	}

	public String getGroup() {
		return getString("group");
	}
	
	public String getTimeStart(){
		return getTime().split("-")[0];
	}
	
	public String getTimeFinish(){
		return getTime().split("-")[1];
	}

}
